//store.ts:

import { createStore } from "vuex";
import persistedState from "vuex-persistedstate";
const store = createStore({
  state() {
    return {
      count: "666",
      tableData: [],
    };
  },
  getters: {
    getCount(state) {
      return state.count;
    },
  },
  modules: {
    //加载模块的意思 当数据state较多的时候可以分模块管理
  },
  mutations: {
    //actions第一个参数永远是context
    increment(state) {
      state.count++;
    },

    setTableData(state, data) {
      state.tableData = data;
    },
  },
  actions: {
    //动作的意思 执行异步操作的 dispatch//派遣的意思
  },
  plugins: [persistedState()],
});

export default store;
